var _n71;
var cc__extends = __extends;
var cc__importDefault = __importDefault;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var $1$zqcc_frameNamespace = require("zqcc_frameNamespace");
var a = cc__importDefault($1$zqcc_frameNamespace);
var $1$h5Api = require("h5Api");
var s = cc__importDefault($1$h5Api);
var $1$huaWeiApi = require("huaWeiApi");
var c = cc__importDefault($1$huaWeiApi);
var $1$oppoApi = require("oppoApi");
var l = cc__importDefault($1$oppoApi);
var $1$ttApi = require("ttApi");
var u = cc__importDefault($1$ttApi);
var $1$vivoApi = require("vivoApi");
var p = cc__importDefault($1$vivoApi);
var $1$wxApi = require("wxApi");
var d = cc__importDefault($1$wxApi);
var def_platformService = function (t) {
  function _ctor() {
    // 调用 t 函数，并确保上下文为当前对象
    const instance = t.call(this) || this;

    // 初始化服务名称和平台 API
    instance._serviceName = "平台服务";
    instance.m_PlatformApi = undefined;

    // 调用初始化方法
    instance._Initialize();

    return instance; // 返回实例
  }
  cc__extends(_ctor, t);
  Object.defineProperty(_ctor.prototype, "platformApi", {
    get() {
      return this.m_PlatformApi;
    },
    enumerable: false,
    configurable: true
  });
  _ctor.prototype._Initialize = function () {
    // 调用父类的初始化方法
    t.prototype._Initialize.call(this);

    // 执行平台检查
    this.platformCheck();

    // 创建平台 API 实例
    this.m_PlatformApi = new _ctor.m_PlatformApiClass();
    console.log("加载平台 API");

    // 验证应用 ID
    this.m_PlatformApi.validAppId();

    // 标记平台 API 准备就绪
    this.m_PlatformApi.ready();
  };
  _ctor.prototype.platformCheck = function () {
    // 检查是否存在 "gamebox" 属性
    if (window.hasOwnProperty("gamebox")) {
      console.warn("4399游戏盒子");
      _ctor.m_PlatformApiClass = s.default; // 设置平台 API 类为默认
      return; // 提前返回
    }

    console.log("平台：" + cc.sys.platform); // 输出平台信息

    // 根据平台类型选择相应的 API 类
    switch (cc.sys.platform) {
      case cc.sys.WECHAT_GAME_SUB:
      case cc.sys.WECHAT_GAME:
        _ctor.m_PlatformApiClass = d.default;
        break;
      case cc.sys.BYTEDANCE_GAME:
      case cc.sys.BYTEDANCE_GAME_SUB:
        _ctor.m_PlatformApiClass = u.default;
        break;
      case cc.sys.VIVO_GAME:
        _ctor.m_PlatformApiClass = p.default;
        break;
      case cc.sys.OPPO_GAME:
        _ctor.m_PlatformApiClass = l.default;
        break;
      case cc.sys.HUAWEI_GAME:
        _ctor.m_PlatformApiClass = c.default;
        break;
      default:
        if (cc.sys.isNative) {
          _ctor.m_PlatformApiClass = s.default;
        } else if (3 == cc.sys.platform || 4 == cc.sys.platform) {
          _ctor.m_PlatformApiClass = s.default;
        } else {
          window.hasOwnProperty("h5api");
          _ctor.m_PlatformApiClass = s.default;
        }
    }
  };
  _ctor.getPlatformApiClass = function () {
    return _ctor.m_PlatformApiClass;
  };
  _ctor.m_PlatformApiClass = null;
  return _ctor;
}(a.default.zqcc_ServiceBase);
exports.default = def_platformService;